import Mock from 'mockjs'

// extend--延展mock功能,如：手机号
Mock.Random.extend({
    phone(){
        // 自己编写前缀
        const phoneQZui = ['158','187','151']
        // 随机返回前缀,并拼接8位数
        return this.pick(phoneQZui) + Mock.mock(/\d{8}/)
    }
})
Mock.mock('/mock/login','get',{
    code: 200 ,
    ...{'data|5' : [{"id|+1": 1 , "phone":Mock.Random.phone() ,"zh_name":"@cname" ,"en_name":"@name","image":"@image(200x200, #50B347, #fff, 头像)","title":"@ctitle(2,12)","cparagraph":"@cparagraph(1,3)"}]}
})
Mock.mock('/mock/login2','post',{
    code: 200 ,
    ...{'data|3' : [{"id|+10": 1 , "email":"@email" ,"role":'@pick(["董事长", "总监", "经理", "组长"])', "image":"@image(200x200, #50B347, #fff, hello)", "datetime":"@datetime('2023-MM-dd HH:mm:ss')"}]}
})